package com.aaa.behind.service.impl;

import com.aaa.entity.TbBanner;
import com.aaa.behind.dao.TbBannerMapper;
import com.aaa.behind.service.ITbBannerService;
import com.aaa.util.PageInfo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 首页banner表 服务实现类
 * </p>
 *
 * @author whj
 * @since 2023-02-01
 */
@Service
public class TbBannerServiceImpl extends ServiceImpl<TbBannerMapper, TbBanner> implements ITbBannerService {

    @Override
    public Page rotationSearch(PageInfo pageInfo, TbBanner tbBanner) {
        QueryWrapper queryWrapper = new QueryWrapper();
        if (tbBanner.getTitle() != null){
            queryWrapper.like("title",tbBanner.getTitle());
        }
        if (tbBanner.getIsDisable() != null){
            queryWrapper.eq("is_disable",tbBanner.getIsDisable());
        }

        return this.page(pageInfo,queryWrapper);
    }
}
